#pragma once
#include"HashBacket.h"
	template <class K,class	V,class Hash= HashFunc<K>>
	class unordered_map
	{
		struct MapKeyOfT
		{
			const K& operator()(const pair<K, V>& aw)
			{
				return aw.first;
			}
		};
	public:
		typedef typename HashTable<K, pair<const K, V>, MapKeyOfT, Hash>::Iterator iterator;
		typedef typename HashTable<K, pair<const K, V>, MapKeyOfT, Hash>::ConstIterator const_iterator;
		iterator begin()
		{
			return _as.Begin();
		}
		iterator end()
		{
			return _as.End();
		}
		const_iterator begin()const
		{
			return _as.Begin();
		}
		const_iterator end()const
		{
			return _as.End();
		}
		pair<iterator, bool> insert(const pair<K,V>& as)
		{
			return _as.Insert(as);
		}
		iterator find(const K& key)
		{
			return _as.Find(key);
		}
		bool erase(const K& key)
		{
			return _as.Erase(key);
		}
		V& operator[](const K& key)
		{
			pair<iterator, bool> ret = insert({key,V() });
			return ret.first->second;
		}
	private:
		HashTable<K, pair<const K, V>, MapKeyOfT, Hash> _as;
	};
